package service1;

import beans1.Officebean;
import db1.OfficeDAO;

import java.sql.SQLException;
import java.util.ArrayList;

public class OfficeService {

    public ArrayList<Officebean> browse(){
        OfficeDAO dao =new OfficeDAO();
        return  dao.getAllRecords();
    }


    public int delOffice(Officebean user)
    {
        OfficeDAO userDao=new OfficeDAO();
        if(userDao.deleteRecord(user))
            return 1;
        else
            return 2;
    }
    public boolean editOffice(Officebean user) throws SQLException {
        OfficeDAO userDao=new OfficeDAO();
        if(userDao.editOffice(user))
            return true;
        else
            return false;
    }

    public boolean insertOffice(Officebean user) throws SQLException {
        OfficeDAO userDao=new OfficeDAO();
        if(userDao.insertOffice(user))
            return true;
        else
            return false;
    }
}
